package com.hhs.storage.bean;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

@Data
public class ResponseBean<T> {
    private ResponseBean(){}
    public static ResponseBean getInstance(){
        return new ResponseBean();
    }
    public static ResponseBean error(String msg){
        ResponseBean res=new ResponseBean();
        res.setCode(0);
        res.setMsg(msg);
        return res;
    }
    public static ResponseBean success(Object o) {
        ResponseBean res=new ResponseBean();
        res.setData(o);
        res.setCode(1);
        return res;
    }
    /**
     * 返回码
     */
    @ApiModelProperty(name = "code",value = "返回码1正确，0错误(是)",required = true)
    private Integer code;
    /**
     * 错误消息
     */
    @ApiModelProperty(name = "msg",value = "返回错误消息(否)",required = false)
    private String msg;
    /**
     * 数据
     */
    @ApiModelProperty(name = "data",value = "数据(否)",required = false)
    private T data;
    /**
     * token
     */
    @ApiModelProperty(name = "token",value = "数据(否)",required = false)
    private String token;


}
